﻿using System;
using System.Windows;
using MyFloridaHouse.libSvCommonUtilities;
using MyFloridaHouse.ServiceConn.DistrBldrSvcRef;

namespace MyFloridaHouse.libSvOpenDistricts.DataService
{
    public partial class ServiceDAL
    {
        public void GetDistrictDataSummary(int iDistrictID, string iShapeUogIDList, string iSourceLayerIDList, string iDictionaryIDList, System.EventHandler<GetDistrictDataSummaryCompletedEventArgs> completedHandler)
        {
            try
            {
                //MyDistrictBuilderServiceClient proxy = new MyDistrictBuilderServiceClient(myRelativeBinding, myRelativeCensusDataServiceAddress);
				var proxy = new DistrBldrClient(_relativeBindingName);
                proxy.GetDistrictDataSummaryCompleted += completedHandler;
                //TODO: Should shapeUogIDList be compressed like it is in GetDistrictShape?
                proxy.GetDistrictDataSummaryAsync(iDistrictID, CompressionManager.Compress(iShapeUogIDList), iSourceLayerIDList, iDictionaryIDList);
                getDistrictDataSummaryRequestCount++;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private int _getDistrictDataSummaryRequestCount = 0;
        public int getDistrictDataSummaryRequestCount
        {
            get { return _getDistrictDataSummaryRequestCount; }
            set
            {
                if (_getDistrictDataSummaryRequestCount != value)
                {
                    _getDistrictDataSummaryRequestCount = value;
                    NotifyPropertyChanged("getDistrictDataSummaryRequestCount");
                }
            }
        }

    }
}
